﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="preview.aspx.cs" Inherits="www.pages.sys.preview" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../../css/lanai-ui.min.css" rel="stylesheet" />
</head>
<body>
    <section class="content">
        <div class="top topbox">
            <div class="box-body pull-right">
                <div class="btn btn-group">
                    <button id="btnExportWord" type="button" class="btn btn-success"><i class="fa fa-file-word-o"></i>WORD</button>
                    <button id="btnExportPdf" type="button" class="btn btn-success"><i class="fa fa-file-pdf-o"></i>PDF</button>
                </div>
            </div>
        </div>
        <form id="form1" runat="server">
            <asp:Repeater ID="list_docs" runat="server">
                <HeaderTemplate>

                    <div class="box box-widget no-shadow no-radius-childs">
                        <div class="box-body no-pad-top">
                </HeaderTemplate>
                <ItemTemplate>
                    <section class="invoice">
                        <h2 class="page-header">
                            <%#Eval("title") %>
                        </h2>
                        <div class="page-content invoice-info">
                            <%#Eval("Content") %>
                        </div>
                    </section>
                </ItemTemplate>
                <FooterTemplate>
                    </div>
            </div>
                </FooterTemplate>
            </asp:Repeater>
            <input type="hidden" id="hid_Project" runat="server" value="0" />
            <input type="hidden" id="hid_docs" runat="server" value="0" />
        </form>
    </section>
    <script src="../../js/jquery.min.js"></script>
    <script src="../../plugins/word/FileSaver.js"></script>
    <script src="../../plugins/word/jquery.wordexport.js"></script>
    <script src="../../plugins/pdf/html2canvas/html2canvas.js"></script>
    <script src="../../plugins/pdf/jspdf/jspdf.debug.js"></script>
    <script src="../../plugins/pdf/PDFExport.js"></script>
    <script src="../../js/lanai-ui.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#btnExportWord").click(function () {
                $(".invoice").each(function (i, el) {
                    var filename = $.trim($(el).find(".page-header").text());
                    $(el).find(".page-content").wordExport(filename);
                });
                //var filename = $.trim($(".invoice .page-header").text());
                //$(".invoice .page-content").wordExport(filename);
            });

            $("#btnExportPdf").click(function () {
                $(".invoice").each(function (i, el) {
                    var filename = $.trim($(el).find(".page-header").text());
                    HtmlToPDF(filename, $(el).find(".page-content"));
                });
                //var filename = $.trim($(".invoice .page-header").text());
                //HtmlToPDF(filename, $(".invoice .page-content"));
            });
        });
    </script>
</body>
</html>
